<?php

$conn = mysql_connect("localhost", "root", "yubaokeji");
mysql_select_db("analysis", $conn);

$result = mysql_query("select * from ana_riskcontrol where ril_status=1", $conn);
$listrocord = mysql_num_rows($result);

if ($listrocord > 0) {
    while ($risklist = mysql_fetch_array($result)) {
        $record = mysql_query("select * from ana_deallogs where dll_id=" . $risklist['ril_dllid']);
        $info = mysql_fetch_array($record);
        mysql_query("update ana_deallogs set dll_status=0 where dll_id=" . $risklist['ril_dllid']);
        mysql_query("update ana_cash set c_status=0 where c_ordsn='" . $info["dll_ordsn"] . "'");
        mysql_query("update ana_riskcontrol set ril_status=0 where ril_id=" . $risklist["ril_id"]);
    }
}


mysql_close($conn);
